<template>
	<view class="page_userInfo">
		<view class="status-bar"></view>
		<view class="userInfo">
			<view class="left">
				<image src="@/static/common/user_active.png" class="commentImg"></image>
			</view>
			<view class="right">
				<view class="name">
					{{userInfo.nickName}}
					<text class="tag">{{userInfo.roleNameList[0]||'无角色'}}</text>
				</view>
				<view class="company">
					<view class="text">{{userInfo.compName||'暂无公司'}}</view>
					<!-- <text class="tag">建设单位</text> -->
				</view>
			</view>
		</view>
		<view class="setting">
			<!-- <view class="item" @click="goDateil('approve')">
				<uni-icons type="compose" size="30"></uni-icons>
				<text class="title">流程审批</text>
			</view> -->
			<view class="item" @click="goDateil('QRcode')">
				<uni-icons type="scan" size="30"></uni-icons>
				<text class="title">扫一扫</text>
			</view>
			<view class="item" @click="goDateil('map')">
				<uni-icons type="map" size="30"></uni-icons>
				<text class="title">地图区域</text>
			</view>
			<!-- <view class="item" @click="goDateil('message')">消息通知</view> -->
			<view class="item" @click="goDateil('user')">
				<uni-icons type="staff" size="30"></uni-icons>
				<text class="title">员工管理</text>
			</view>
			<view class="item" @click="goDateil('equipment')">
				<uni-icons type="medal" size="30"></uni-icons>
				<text class="title">工程设备</text>
			</view>
			<view class="item" @click="goDateil('device')">
				<uni-icons type="tune" size="30"></uni-icons>
				<text class="title">检测设备</text>
			</view>
			<view class="item" @click="goDateil('project')">
				<uni-icons type="list" size="30"></uni-icons>
				<text class="title">项目列表</text>
			</view>
			<!-- <view class="item" @click="goDateil('logout')">退出登陆</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello',
				userInfo:{},
				setList:[
					{
						title:'',
						path:''
					}
				]
			}
		},
		onLoad() {
			this.userInfo = uni.getStorageSync('userInfo')||{}
		},
		methods: {
			goDateil(type) {
				switch(type){
					case 'project':
						uni.navigateTo({ url:'/pages/index/index' })
						break;
					case 'message':
						uni.switchTab({ url:'/pages/message/index' })
						break;
					case 'user':
						uni.navigateTo({ url:'/pages/user/index' })
						break;
					case 'equipment':
						uni.navigateTo({ url:'/pages/equipment/index' })
						break;
					case 'device':
						uni.navigateTo({ url:'/pages/device/index' })
						break;
					case 'approve':
						uni.navigateTo({ url:'/pages/approve/index' })
						break;
					case 'QRcode':
						uni.scanCode({
							onlyFromCamera: true,
							success:(res)=>{
								uni.navigateTo({ url:'/pages/qrCode/index?'+res.result })
							},
							fail:()=>{
								console.log('quxiao')
							}
						})
						break;
					case 'map':
						uni.navigateTo({ url:'/pages/maps/index'})
						break;
					default: 
					break;
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/assets/styles/global.scss';

	.page_userInfo {
		.userInfo {
			height: 350upx;
			background:linear-gradient(to bottom, #fff, deepskyblue);
			display: flex;
			align-items: center;
			padding: 0 20upx;

			.left {
				background-color: #fff;
				border-radius: 50%;
				width: 120upx;
				height: 120upx;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-right: 20upx;

				.commentImg {
					width: 100upx;
					height: 100upx;
				}
			}

			.right {
				width: 80%;

				.name {
					font-size: 44upx;
					margin-bottom: 10upx;
					color: #333;
				}

				.company {
					font-size: 36upx;
					color: #333;
					max-height: 100upx;
					display: flex;
					align-items: flex-start;

					.text {
						max-width: 70%;
					}
				}
				
				.tag {
					font-size: 30upx;
					color: orange;
					background-color: #fff;
					margin-left: 10upx;
					padding: 4upx 10upx;
					border-radius: 20upx;
				}
			}
		}

		.setting {
			width: 100%;
			padding: 34upx 24upx;

			.item {
				width: 100%;
				margin: 0 0 24upx;
				font-size: 46upx;
				padding: 24upx;
				border-radius: 40upx;
				background-color: #eee;
				display: flex;
				align-items: center;
				.title{
					margin-left: 10rpx;
				}
			}
		}
	}
</style>